package io;
import java.io.IOException;
import java.net.URI;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;

import com.google.gson.Gson;

public class ListStatus {
	public static void main(String[] args) throws IOException {

		Gson gson=new Gson();
		String uri="hdfs://node1:9000";
		Configuration conf=new Configuration();
		FileSystem fs=FileSystem.get(URI.create(uri), conf);
		FileStatus[] status=fs.listStatus(new Path("/user/hadoop"));
		FileStatus fst=	fs.getFileStatus(new Path("/user/hadoop/test.txt"));
 		System.out.println(gson.toJson(status));
	
	}
}
